package koction.model.product;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class ProductDaoImpl implements ProductDao {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	
	public List<ProductVO> getProductListByCategory(String category){
		return this.sqlSessionTemplate.selectList("product.getProductListByCategory",category);
	}
	
	public List<ProductVO> searchProductListByName(String name){
		return this.sqlSessionTemplate.selectList("product.searchProductListByName",name);
	}
	
	/*public List<ProductVO> searchProductListByMaker(String maker){
		return this.sqlSessionTemplate.selectList("product.searchProductListByMaker",maker);
	}
	
	public List<ProductVO> findProductListByPrice(Map map){
		return this.sqlSessionTemplate.selectList("product.findProductListByPrice",map);
	}*/
	
	public List<ProductVO> searchProductByNameAndCategory(Map map){
		return this.sqlSessionTemplate.selectList("product.searchProductByNameAndCategory",map);
	}
	public ProductVO getProductInfo(String productId){
		return this.sqlSessionTemplate.selectOne("product.getProductInfo",productId);
	}
}
